decorative banner

FileSystem Object


    File("path").
    Folder("path").

Description

    The FileSystem object contains methods and attributes common to both File and Folder objects. A File object corresponds to a disk file, while a Folder object matches a directory or folder. "FileSystem" is a name used to refer to both Folders and Files.

    These attributes and methods differ from those found under the FileSystem Class in that they cannot be applied without referring to a particular instance of a file or folder, expressed as a path to that file or folder.

    You can use absolute path names and relative path names. Absolute path names start with one or two slash characters. These path names describe the full path from a root directory down to a file or folder. Relative path names start from a known location, the current directory. A relative path name starts either with a directory name or with one of the special names "." and "..". The name "." refers to the current directory, and the name ".." refers to the parent directory. The slash character is used to separate path elements. Special characters are encoded in UTF-8 notation.

    The FileSystem objects support a common convention. A volume name may be the first part of an absolute path. The objects know where to look for the volume names on the Macintosh and Windows and they translate the volume names accordingly.

    A path name can also start with the tilde "~" character. This character stands for the user's home directory (on Mac). On Windows, a directory with the environment variable HOME or, failing that, the desktop is used as a home directory.

    The following table illustrates how the root element of a full path name is used on different file systems. In these examples, the current drive is C: on Windows and "Macintosh HD" on the Macintosh.

    URI

    Windows Name

    Macintosh Name

    /d/dir/name.ext

    D:\dir\name.ext

    Macintosh HD:d:dir:name.ext

    /Macintosh HD/dir/name.ext

    C:\Macintosh HD\dir\name.ext

    Macintosh HD:dir:name.ext

    Thus if you have to use a script with URI notation on both Mac and Windows, try to use relative path names, or try to originate your path names from the home directory. If that is not possible, it is recommended that you work with Mac OS X aliases andn UNC names on Windows, and store files on a machine that is remote to the Windows machine on which the script is running.

Attributes

    absoluteURI

    see FileSystem absoluteURI Attribute

    The full path name for the object in URI notation.

    alias

    see FileSystem alias Attribute

    Returns true if the object refers to a file system alias.

    created

    see FileSystem created Attribute

    The creation date of the object.

    error

    see FileSystem error Attribute

    Contains a message describing the last file system error.

    exists

    see FileSystem exists Attribute

    Returns true if the path name of this object refers to an actually existing file or folder.

    fsName

    see FileSystem fsName Attribute

    The file-system specific name of the object as a full path name.

    modified

    see FileSystem modified Attribute

    The date of the object's last modification.

    name

    see FileSystem name Attribute

    The name of the object without the path specification.

    parent

    see FileSystem parent Attribute

    The folder object containing this object.

    path

    see FileSystem path Attribute

    The path portion of the absolute URI.

    relativeURI

    see FileSystem relativeURI Attribute

    The path name for the object in URI notation, relative to the current folder.

Methods

    getRelativeURI()

    see FileSystem getRelativeURI() Method

    Calculate and return the relative URI, given a base path, in URI notation.

    remove()

    see FileSystem remove() Method

    Delete the file or folder that this object represents.

    rename()

    see FileSystem rename() Method

    Rename the object to the new name.

    resolve()

    see FileSystem resolve() Method

    Attempt to resolve the file system alias that this object points to.